import $http from './axios'
import $httpMock from './mockRequest'

//请求 三级联动框  数据
export const requsetHttpData= ()=> $http({url:'/product/getBaseCategoryList',method:'get'})

//请求 轮播图图片、floor中数据
export const requsetHttpCarousel=()=> $httpMock.get('/banner')
export const requsetHttpFloor=()=> $httpMock.get('/floor')

//请求 搜索页数据
export const requsetHttpSearch=(searchParams)=>$http({url:"/list",method:"post",data:searchParams})

//请求  当前商品详情
export const requsetHttpDetails=(detailId)=>$http({url:`/item/${detailId}`,method:"get"})

//请求 添加到购物车 || 对已有物品进行数量改动
export const reqAddOrUpdateCart=(skuId,skuNum)=>$http({url:`/cart/addToCart/${skuId}/${skuNum}`,method:'post'})

//请求 购物车列表
export const reqCartList=()=>$http({url:"/cart/cartList",method:'get'})

//删除 购物车物品
export const reqDelCarts=(skuId)=>$http({url:`/cart/deleteCart/${skuId}`,method:'DELETE'})

//修改 全部选中状态
export const reqCheckAll=(skuId,isChecked)=>$http({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'})

//登录
export const reqLogin=(data)=>$http({url:`/user/passport/login`,method:'post',data})

//注册
export const reqRegister=(data)=>$http({url:`/user/passport/register`,method:'post',data})

//获取验证码
export const reqCode=(phone)=>$http({url:`/user/passport/sendCode/${phone}`,method:'get'})

//获取 登录用户信息
export const reqUserInfo=()=>$http({url:'/user/passport/auth/getUserInfo',method:'get'})

//退出 登录
export const reqDelLogin=()=>$http({url:`/user/passport/logout`,method:'get'})

//获取 用户地址信息
export const reqUserAddress=()=>$http({url:'/user/userAddress/auth/findUserAddressList',method:"get"})

//获取 用户订单信息
export const reqOrederInfo=()=>$http({url:'/order/auth/trade',method:'get'})

//提交 订单
export const reqSubmitOrder = (tradeNo,data)=>$http({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,data,method:'post'});

//获取 订单支付信息
export const reqUserOrderInfo=(orderId)=>$http({url:`/payment/weixin/createNative/${orderId}`,method:'get'})

//获取 订单状态
export const reqOrderState=(orderId)=>$http({url:`/payment/weixin/queryPayStatus/${orderId}`,method:'get'})

//获取 我的订单列表
export const reqMyOrderList=(page,limit)=>$http({url:`/order/auth/${page}/${limit}`})